package limitation;

import com.atguigu.Main;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * Created by 小可乐$ on 2024/9/11$ 19:50$
 * description: 消费者限流演示，生产者代码
 */
@SpringBootTest(classes = Main.class)
public class RabbitMQLimitation {
    @Autowired
    private RabbitTemplate rabbitTemplate;
    public static final String EXCHANGE_DIRECT ="atguigu.exchange.direct";
    public static final String ROUTING_KEY = "atguigu.routing.key.good";

    /***
     *
     */
    @Test
    public void Test(){

        for (int i = 0; i < 100; i++) {
            rabbitTemplate.convertAndSend(EXCHANGE_DIRECT,ROUTING_KEY,"消费者限流测试"+i);
        }
    }
}
